import { defHttp } from '/@/utils/http/axios';

const Api = {
  Messages: '/blog/messages',
  MessageReplies: '/blog/messageReplies',
};

/**
 * 获取公开留言列表
 */
export const getPublicMessages = (params: any) => {
  return defHttp.get({
    url: `${Api.Messages}/public/list`,
    params,
  });
};

/**
 * 提交留言
 */
export const submitMessage = (data: any) => {
  return defHttp.post({
    url: `${Api.Messages}/public/add`,
    data,
  });
};

/**
 * 提交回复
 */
export const submitReply = (data: any) => {
  return defHttp.post({
    url: `${Api.Messages}/public/reply`,
    data,
  });
};

/**
 * 点赞留言
 */
export const likeMessage = (id: string) => {
  return defHttp.post({
    url: `${Api.Messages}/public/like`,
    params: { id },
  });
};

/**
 * 点赞回复
 */
export const likeReply = (id: string) => {
  return defHttp.post({
    url: `${Api.MessageReplies}/public/like`,
    params: { id },
  });
};

/**
 * 获取留言统计
 */
export const getMessageStats = () => {
  return defHttp.get({
    url: `${Api.Messages}/public/stats`,
  });
}; 